﻿
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	获取临时补助申请单条记录
-- =============================================
CREATE PROCEDURE [dbo].[proc_Employee_Subsidy_GetItem]
	(
	@id int,
	@GID uniqueidentifier
	)
AS
BEGIN
	SELECT  ed.[id]
      ,ed.[Eid]
      ,ed.[EName]
      ,ed.[Companyid]
      ,ed.[Departmentid]
      ,ed.[ApplionMoney]
      ,ed.[ApplionMonth]
      ,ed.[Reason]
      ,ed.[ApplionTime]
      ,ed.[flag]
      ,ed.[Proposer]
      ,ed.[ProposerName]
      ,ed.[FirstAuditPerson]
      ,ed.[FirstAuditPersonName]
      ,Convert(varchar(10),ed.[FirstAuditDate],120) as FirstAuditDate
      ,ed.[FirstMemo]
      ,(case companyname when '' then (select companyname from company where company.id=ed.companyid) else companyname end) as companyname
      ,(case DepartmentName when '' then (select DName from Department where id=ed.departmentid) else DepartmentName end) as DepartmentName
      ,e.Enumber
      ,e.RuzhiDate
      ,e.IDcard
      ,isnull(e.ZzDate,'1900-1-1') as ZzDate
      ,e.ETempNumber
  FROM [Employee_Subsidy] as ed,Employee e where ed.id=@id and ed.GID=@GID and ed.eid=e.id
  
END

